package com.Cychat.AI.tools;

import com.Cychat.commons.entity.ResultMessage;
import com.Cychat.commons.entity.pojo.Product;
import com.Cychat.commons.entity.vo.DoctorVo;
import com.Cychat.commons.feign.MallFeignService;
import org.springframework.ai.tool.annotation.Tool;
import org.springframework.ai.tool.annotation.ToolParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * Auther: 谢宝辉  <br/>
 * Date: 2025/11/6:15:47  <br/>
 * Description: 商城工具类
 */
@Component
public class MallTools {

    @Autowired
    private MallFeignService mallFeignService;

    @Tool(description = "根据商品描述或者商品种类描述，给出能够具体的商品信息")
    public ResultMessage<List<Product>> getAllProducts(@ToolParam(description = "商品描述或者商品种类描述") String description){
        ResultMessage<List<Product>> result = mallFeignService.list(null);
        if(result.getData() == null){
            return ResultMessage.error("暂无商品信息");
        }
        return result; // 直接返回封装后的结果
    }

    @Tool(description = "根据商品描述或者询问商品种类，给出能够解决该商品的商品分类或者现有的商品分类")
    public ResultMessage<List<String>> getProductCategory(@ToolParam(description = "商品描述") String description){
        ResultMessage<List<String>> result = mallFeignService.list();
        if(result.getData() == null){
            return ResultMessage.error("暂无商品信息");
        }
        return result; // 直接返回封装后的结果
    }
}
